1 /*
2 QueryJ
3
4 Copyright (C) 2002 Jose San Leandro Armend?riz
5 jsanleandro@yahoo.es
6 chousz@yahoo.com
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
17
18 You should have received a copy of the GNU General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
22 Thanks to ACM S.L. for distributing this library under the GPL license.
23 Contact info: jsanleandro@yahoo.es
24 Postal Address: c/Playa de Lagoa, 1
25 Urb. Valdecaba?as
26 Boadilla del monte
27 28660 Madrid
28 Spain
29
30 ******************************************************************************
31 *
32 * Filename: $RCSfile: NestedConditionOperator.java,v $
33 *
34 * Author: Jose San Leandro Armend?riz
35 *
36 * Description: Represents condition operators involving nested queries
37 * SQL statements.
38 *
39 * Last modified by: $Author: chous $ at $Date: 2003/08/29 08:14:59 $
40 *
41 * File version: $Revision: 1.1 $
42 *
43 * Project version: $Name: $
44 *
45 * $Id: NestedConditionOperator.java,v 1.1 2003/08/29 08:14:59 chous Exp $
46 *
47 */
48 package org.acmsl.queryj;
49
50 /*
51 * Importing some ACM-SL classes.
52 */
53 import org.acmsl.queryj.Condition;
54 import org.acmsl.queryj.ConditionOperator;
55 import org.acmsl.queryj.Field;
56
57 /***
58 * Represents condition operators involving nested queries SQL statements.
59 * @author <a href="mailto:jsanleandro@yahoo.es"
60 >Jose San Leandro</a>
61 * @version $Revision: 1.1 $
62 */
63 public abstract class NestedConditionOperator
64 extends ConditionOperator
65 {
66 /***
67 * The nested query.
68 */
69 private SelectQuery m__Query;
70
71 /***
72 * Creates a nested operator using given information.
73 * @param symbol the symbol.
74 * @param query the operator query.
75 */
76 public NestedConditionOperator(String symbol, SelectQuery query)
77 {
78 super(symbol);
79 unmodifiableSetQuery(query);
80 }
81
82 /***
83 * Specifies the operator query.
84 * @param query the query.
85 */
86 private void unmodifiableSetQuery(SelectQuery query)
87 {
88 m__Query = query;
89 }
90
91 /***
92 * Specifies the operator query.
93 * @param query the query.
94 */
95 protected void setQuery(SelectQuery query)
96 {
97 unmodifiableSetQuery(query);
98 }
99
100 /***
101 * Retrieves the operator query.
102 * @return such query.
103 */
104 public SelectQuery getQuery()
105 {
106 return m__Query;
107 }
108
109 /***
110 * Checks if given object is logically equal to this one.
111 * @param candidate the object to check.
112 * @return <code>true</code> if both objects are logically equal.
113 */
114 public boolean equals(Object candidate)
115 {
116 boolean result = super.equals(candidate);
117
118 if (!result)
119 {
120 result = !(candidate instanceof NestedConditionOperator);
121 }
122
123 if (!result)
124 {
125 NestedConditionOperator t_Candidate =
126 (NestedConditionOperator) candidate;
127
128 result = (t_Candidate.getQuery() == getQuery());
129
130 if (!result)
131 {
132 result = (t_Candidate.getQuery() != null);
133
134 if (result)
135 {
136 result = (t_Candidate.getQuery().equals(getQuery()));
137 }
138 else
139 {
140 result = (getQuery() == null);
141 }
142 }
143 }
144
145 return result;
146 }
147 }
148
This page was automatically generated by Maven